<template>
  <div class="dream-card">
    <div class="img-container">
      <img :src="value.image_url"/>
      <!-- value.image_url -->
    </div>
    <div class="card-bottom">
      <div class="name">{{value.title}}</div>
      <div class="progress-contaier"><el-progress :percentage="value.sold / (value.sold + value.rest) * 100" :show-text="false"></el-progress></div>
      <div class="num">剩余{{value.rest}}次</div>
      <div class="btn-group">
        <button class="yellow2-btn" @click="goDreamDetail">立即圆梦</button>
      </div>
    </div>
  </div>
</template>

<script>
import dream from '@/assets/mock_images/dream.png'
export default {

  name: 'dreamCard',

  data() {
    return {
      dream
    }
  },
  methods: {
    goDreamDetail() {
      this.$router.push('/mall/dream-detail/' + this.value.id)
    }
  },
  props: {
    value: {
      type: Object,
      default: function() { return { /*  */ } }
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.dream-card{
  float: left;
  height: 355px;
  width: 224px;
  margin: 10px;
  box-shadow: 0px 0px 20px rgba(218, 218, 218, 0.5);
  transition: all .5s;
  cursor: pointer;
  .img-container {
    height: 175px;
    width: 225px;
    text-align: center;
    overflow: hidden;
    img{
      height: 175px;// todo
      transition: all .5s;
    }
  }
  &:hover {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    .img-container {
      img{
        transform: scale(1.1);
      }
    }
  }
  .card-bottom{
    padding: 16px;
    .name{
      font-size: 16px;
      padding: 2px 0 12px 0;
    }
    .progress-contaier{

    }
    .num{
      line-height: 30px;
      color: #999;
    }
    .btn-group{
      text-align: center;
      margin-top: 20px;
      >button{
        width: 100px;
      }
    }
  }
}
</style>